#include "logo.h"

char *readlist(void)
{
     char *list;
     char listStr[MAXVALUE] ="\0";
     char ch;
     int k;
     int i;
     
     list =listStr;
     //printf("welcome to readlist\n");
     i =1;
     k =1;
     while (k !=0)
     {
           //printf("readlist char is %c. %d\n",ch,k);
           
           ch =getcharInput();
           while (isspace(ch)&&(i))
           {
                 ch =getcharInput();
           }
           if ((i)&&(ch =='['))
           {
              k--;
              i--;
           }
           if (ch =='[')
           {
              k++;
           }else if (ch ==']')
           {
                 k--;
           }else if (isspace(ch))
           {
                 list[strlen(list)+1] ='\0';
                 list[strlen(list)] =' ';
                 continue;
           }
           list[strlen(list)+1] ='\0';
           list[strlen(list)] =ch;
     }
     //putcharInput(ch);
     printf("readlist is %s\n", list);
     return list;
}
